/*
 * Copyright (C) 2011 by Fabien Barbero
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package com.flickr.api.galleries;

import com.flickr.api.FlickrServiceException;
import com.flickr.api.Paginated;
import com.flickr.api.people.User;
import com.flickr.api.photos.Photo;
import java.util.List;

/**
 *
 * @author Fabien Barbero
 */
public interface GalleriesService {
    
    /**
     * Add a photo to a gallery.
     * @param gallery                   The gallery.
     * @param photo                     The photo to add.
     * @param comment                   A comment for the photo (can be null).
     * @throws FlickrServiceException   Error adding the photo.
     */
    void addPhoto(Gallery gallery, Photo photo, String comment) throws FlickrServiceException;
    
    /**
     * Create a new gallery for the calling user.
     * @param title                     The title of the gallery.
     * @param description               The description of the gallery.
     * @param primaryPhoto              The first photo to add to your gallery (can be null).
     * @return                          The created gallery.
     * @throws FlickrServiceException   Error creating the gallery.
     */
    Gallery createGallery(String title, String description, Photo primaryPhoto) throws FlickrServiceException;
    
    /**
     * Modify the meta-data for a gallery.
     * @param gallery                   The gallery.
     * @param title                     The title of the gallery.
     * @param description               The description of the gallery.
     * @throws FlickrServiceException   Error editing the gallery. 
     */
    void editMeta(Gallery gallery, String title, String description) throws FlickrServiceException;
    
    /**
     * Edit the comment for a gallery photo.
     * @param gallery                   The gallery.
     * @param photo                     The photo to edit.
     * @param comment                   The comment of the photo.
     * @throws FlickrServiceException   Error editing photo.
     */
    void editPhoto(Gallery gallery, Photo photo, String comment) throws FlickrServiceException;
    
    /**
     * Modify the photos in a gallery. Use this method to add, remove and re-order photos.
     * @param gallery                   The gallery.
     * @param primaryPhoto              The primary photo. It must also be passed along in "photos" list argument.
     * @param photos                    The list of photos.
     * @throws FlickrServiceException   Error modifying gallery photos.
     */
    void editPhotos(Gallery gallery, Photo primaryPhoto, List<Photo> photos) throws FlickrServiceException;
    
    /**
     * Return the list of galleries created by a user. Sorted from newest to oldest.
     * @param id                        The identity of a user.
     * @param perPage                   The number of galleries per page.
     * @param page                      The page index to get.
     * @return                          The galleries.
     * @throws FlickrServiceException   Error getting the galleries.
     */
    Paginated<Gallery> getGalleries(User id, int perPage, int page) throws FlickrServiceException;
    
    /**
     * Return the list of galleries to which a photo has been added.
     * Galleries are returned sorted by date which the photo was added to the gallery.
     * @param photo                     The photo.
     * @param perPage                   The number of galleries per page.
     * @param page                      The page index to get.
     * @return                          The galleries.
     * @throws FlickrServiceException   Error getting the galleries.
     */
    Paginated<Gallery> getGalleriesForPhoto(Photo photo, int perPage, int page) throws FlickrServiceException;
    
    /**
     * Return the list of photos for a gallery.
     * @param gallery                   The gallery.
     * @param perPage                   The number of photos per page.
     * @param page                      The page index to get.
     * @return                          The photos.
     * @throws FlickrServiceException   Error getting the photos.
     */
    Paginated<Photo> getPhotos(Gallery gallery, int perPage, int page) throws FlickrServiceException;
    
}
